﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using PMPUtils.DB;
using PMPUtils.Report;
using PMPUtils.Form;

namespace PMP.Reports
{
    public partial class DependentLevelsReport : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            FormUtil.Authenticate(Session, Response);

            try
            {
                DependentLevelOperator.RefreshDependentLevels();

                RefreshForm();
            }
            catch (Exception ex)
            {
                Messenger.Show(Response, "Error: " + ex.Message);
                return;
            }
        }

        private void RefreshForm()
        {
            DependentLevelOperator.RefreshOverallCrystalReport(CrystalReportSource1);
            DependentLevelOperator.RefreshMonthlyCrystalReport(CrystalReportSource2);

            CrystalReportSource1.ReportDocument.Refresh();
            CrystalReportSource2.ReportDocument.Refresh();
        }
    }
}
